package br.ufc.pet.dao;

import javax.persistence.Query;

import br.ufc.pet.model.LogEmail;

public class LogEmailJPADao extends GenericJPADao<LogEmail> implements LogEmailDao{

	public LogEmailJPADao(){
		this.persistenceClass = LogEmail.class;
	}
	
	@Override
	public boolean emailsEnviados() {

		String hql = "select count(e) from LogEmail e";
		
		Query query = em.createQuery(hql);
		
		Long qtd = (Long)query.getSingleResult();
		
		return (qtd == 0);
	}
	
	public static void main(String[] args) {
		new LogEmailJPADao().emailsEnviados();
	}
	
}
